define(['common','clipboard','captcha'], function(common,ClipboardJS,captcha){
    //表格样式
    $('.card-detail table').attr('class','table table-striped table-bordered table-hover');
    //复制分享
    var clipboard = new ClipboardJS('[data-toggle="copy"]', {
        text: function(trigger) {
            return trigger.getAttribute('data-url');
        }
    }).on('success',function(e){
        common.toastMini('复制完成',1000);
    });
    //复制代码
    $('pre').append('<a class="btn-pre" href="javascript:;">复制</a>').on({
        mouseover: function(){
            $(this).find('.btn-pre').show();
        },mouseout:function(){
            $(this).find('.btn-pre').hide();
        }
    });
    var clipboard = new ClipboardJS('.btn-pre', {
        text: function(trigger) {
            return trigger.previousElementSibling;
        }
    }).on('success',function(e){
        $(e.trigger).text('已复制');
    });
    //上下翻页
    var prevPage = $('[data-toggle="prev"]').attr('href');
    var nextPage = $('[data-toggle="next"]').attr('href');
    $(document).on('keydown', function(event) {
        if(event.keyCode==33 && prevPage){
            location = prevPage;
        }
        if(event.keyCode==34 && nextPage){
            location = nextPage;
        }
    });
    //验证码刷新
    captcha.image('#captcha-image');
    //返回
    return true;
});